﻿$(function () {
    /*var dates = $("#date_dbt, #date_fin").datetimepicker({
    dateFormat: 'yy-mm-dd',
    minDate: new Date(),
    defaultDate: "+1w",
    changeMonth: true,
    onSelect: function( selectedDate ) {
    var option = this.id == "date_dbt" ? "minDate" : "maxDate",
    instance = $( this ).data( "datepicker" ),
    date = $.datepicker.parseDate(
    instance.settings.dateFormat ||
    $.datepicker._defaults.dateFormat,
    selectedDate, instance.settings );
    dates.not( this ).datepicker( "option", option, date );
    }
    });*/

    $("#calendar").fullCalendar({
        weekends: true,
        events: function (start,end,callback) {
            $.post("/Eleve/Agenda/Cours", function (data) {
                var events = [];
                $(data).find(".cours").each(function (index, domEle) {
                    events.push({
                        title: $(this).attr('title'),
                        start: $(this).html()
                    });
                });
                callback(events);
            })
            .error(function (xhr, status, error) {
                alert("Une erreur dans la page cible: " + status + "\nError: " + error);
            });
        }
    });


});